using UnityEngine;
using UnityEngine.UI;
using System.Collections;

[AddComponentMenu("TagMachine/UI/Game/Game Info")]
public class UIGameInfo : MonoBehaviour
{
	private Text m_TextComponent = null;

	void Start()
	{
		m_TextComponent = GetComponentInChildren< Text >();
	}

	// Update is called once per frame
	void Update ()
	{
		string GameInfo = "";

		if ( GameModeClassic.Instance.IsGameEnded ||
			GameModeClassic.Instance.IsPaused )
		{
			if ( GameModeClassic.Instance.IsGameEnded )
			{
				GameInfo = "GAME ENDED!";
			}
			else
			{
				GameInfo = "PAUSE!";				
			}
		}
		else
		{
			if ( GameModeClassic.Instance.IsPickingWolf )
			{
				GameInfo = "Next game in : " + 
					Timer.ComputeTimeFromSeconds( GameModeClassic.Instance.PickingComponent.RemainingTime );
			}
			else
			{
				GameInfo = Timer.ComputeTimeFromSeconds( GameModeClassic.Instance.RemainingTime ) + 
				               "\nRound : " + (GameModeClassic.Instance.CurrentRound + 1);
			}
		}

		m_TextComponent.text = GameInfo;
	}
}
